package
{
	import feathers.system.DeviceCapabilities;

	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.system.JPEGLoaderContext;
	import flash.ui.ContextMenu; 

	import miku.firstgame.net.SocketImpl;
	import miku.firstgame.net.proxy.Connection;
	import starling.core.Starling;

	[SWF(width = "800", height = "640", frameRate = "60", backgroundColor = "#cccccc")]
	public class testPunk extends Sprite
	{
		//private var socket:SocketImpl;

		public function testPunk()
		{

			//new SocketImpl();
			if (stage)
				init();
			else
				addEventListener(Event.ADDED_TO_STAGE, init);
		}

		private function init(e:Event = null):void
		{

			var menu:ContextMenu = new ContextMenu();
			menu.hideBuiltInItems();
			this.contextMenu = menu;

			DeviceCapabilities.dpi = 160;
//			DeviceCapabilities.screenPixelWidth = 960;
//			DeviceCapabilities.screenPixelHeight = 640;

			//initSocket();
			//this.stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);

			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point

			//return;
			//Starling.handleLostContext = true;
			var starling1:Starling = new Starling(TestGameEngine, stage);
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;

			starling1.stage.color = 0xffffff;
			starling1.showStats = true;
			starling1.start();

		}

		private function onMouseDown(e:MouseEvent):void
		{
//			if (socket.connected)
//			{
//				socket.send("<justATest />");
//			}

		}

//		private function initSocket():void
//		{
//			socket = new SocketImpl();
//			socket.setHandler(new Connection());
//			socket.connect("localhost", 9123);
//		}
	}
}
